﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
    <script type="text/javascript" language="javascript">
        function greet() {
            alert("Hello stupid");
        }

        function goodBye() {
            alert("Good bye stupid");
        }

        function validateEmail() {
            var matcher = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; ;
            var regEx = RegExp(matcher);
            var email = document.getElementById("email").value;
            if (email.match(regEx)) {
                document.getElementById("result").innerHTML = "valid email";
            }
            else {
                document.getElementById("result").innerHTML = "INvalid email";
             }
         }
    </script>
</head>
<body >
    <input id="email" type="text" />
    <input type="submit" onclick = "validateEmail()"/>
    <p id="result"></p>

</body>
</html>
